package com.airbnb.epoxy.views;

import butterknife.BindComponent;
import butterknife.ButterKnife;
import com.airbnb.epoxy.ModelProp;
import com.airbnb.epoxy.ModelProp.Option;
import com.airbnb.epoxy.ModelView;
import com.airbnb.epoxy.ResourceTable;
import ohos.agp.components.AttrSet;
import ohos.agp.components.DirectionalLayout;
import ohos.agp.components.LayoutScatter;
import ohos.agp.components.Text;
import ohos.app.Context;
import ohos.global.resource.NotExistException;

@ModelView
public class HeaderView extends DirectionalLayout {

  @BindComponent(ResourceTable.Id_title_text)
  Text title;
  @BindComponent(ResourceTable.Id_caption_text) Text caption;

  public HeaderView(Context context, AttrSet attrs) {
    super(context, attrs);
    init();
  }

  private void init() {
    setOrientation(VERTICAL);
    LayoutScatter.getInstance(mContext).parse(ResourceTable.Layout_view_header, null, true);
    ButterKnife.bind(this);
  }

  @ModelProp(options = Option.GenerateStringOverloads)
  public void setTitle(CharSequence title) {
    this.title.setText(title.toString());
  }

  @ModelProp(options = Option.GenerateStringOverloads)
  public void setCaption(CharSequence caption) {
    this.caption.setText(caption.toString());
  }
}
